<!--<!DOCTYPE html>-->
<!--<html lang="en">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <title>Title</title>-->
<!--</head>-->
<!--<body>-->
<!--<form action="/ssm/ali/pay" method="post">-->
<!--    订单号：<input type="text" name="outTradeNo" required><br/>-->
<!--    订单名称：<input type="text" name="subject" required><br/>-->
<!--    付款金额：<input type="text" name="totalAmount" required><br/>-->
<!--    商品描述：<input type="text" name="body"><br/>-->
<!--    <input type="submit" value="下单"> <input type="reset" value="重置">-->
<!--</form>-->
<!--</body>-->
<!--</html>-->

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="app">

    <el-form :model="info" label-width="80px">

        <el-form-item label="订单号">
            <el-input v-model="info.outTradeNo"></el-input>
        </el-form-item>

        <el-form-item label="商品名称">
            <el-input v-model="info.subject"></el-input>
        </el-form-item>
        <el-form-item label="支付价格">
            <el-input v-model="info.totalAmount"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="onSubmit">立即创建</el-button>
            <el-button>取消</el-button>
        </el-form-item>
    </el-form>

</div>

<script type="text/javascript">

    var url = location.search;
    var str = url.split("=")[1];

    var haha = new Vue({
        el: "#app",
        data: {
            pay:{},
            info: {
                outTradeNo:'',
                subject: '',
                totalAmount: ''
            }

        },
        methods: {
            onSubmit() {
                var outTradeNo=haha.info.outTradeNo;
                var subject=haha.info.subject;
                var totalAmount=haha.info.totalAmount;
                location.href="/ssm/ali/pay/?outTradeNo="+outTradeNo+"&subject="+subject+"&totalAmount="+totalAmount;
            }

        }

    });
    haha.info.totalAmount = str;

    let currDate = new Date();
    let year = currDate.getFullYear();
    let month = currDate.getMonth() + 1 < 10 ? "0" + (currDate.getMonth() + 1): currDate.getMonth() + 1;
    let day = currDate.getDate()<10 ? "0"+currDate.getDate() : currDate.getDate();
    //获取年月日
    let date = year + month + day;
    //获取当时时间戳
    let timestamp = Date.parse(currDate);
    //生成订单
    let orderId = date + timestamp;

    haha.info.outTradeNo = orderId;
    haha.info.subject = timestamp;

</script>

</body>
</html>